package com.sales.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;

/**
 * Created by lihu on 2017/10/14.
 */
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
public class CommissionDetails {


    @Id
    @Column(length = 50)
    private String id;

    private String username;

    private String storeId;

    private String storeName;

    //提成金额
    private int commission = 0;


    @CreatedBy
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;

    @LastModifiedDate
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;

    public CommissionDetails(String id, String username, String storeId, String storeName, int commission) {
        this.id = id;
        this.username = username;
        this.storeId = storeId;
        this.storeName = storeName;
        this.commission = commission;
    }
}
